/**
 * @Author: 焦质晔
 * @Date: 2019/6/20
 * @Last Modified by: max.jianhua
 * @Last Modified time: 2020-11-20 15:21:28
 */
import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 需求计划提报(N+1) (DLR)

// 列表 /ttVsDemandPlan1/page
export const queryList = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/page`, params)
export const queryTargetType = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/queryTargetType`, params)
export const queryTotalUrgency = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/queryTotalUrgency`, params)
export const listRecord = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/listRecord`, params)
export const updateStatusLock = (params) => axios.post(`${SERVER.WHOLESALES}/timedtask/lock`, params)
export const planTransOrder = (params) => axios.post(`${SERVER.WHOLESALES}/timedtask/planTransOrder`, params)

// // 一键提交 /ttVsDemandPlan1/done
// export const submit = (params) => axios.get(`${SERVER.WHOLESALES}/ttVsDemandPlan1/done`, {
//   params
// })

//批量添加   /ttVsDemandPlan1/addByTemplateIds
export const saveByIds = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/addByTemplateIds`, params)

export const updateReport = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/updateReport`, params)

// 批量删除 /ttVsDemandPlan1/delList
export const delByIds = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/delList`, params)

// // 查询单条 /ttVsDemandPlan1/selectOne
// export const selectOne = (params) => axios.get(`${SERVER.WHOLESALES}/ttVsDemandPlan1/selectOne`, {
//   params
// })
//
// // 批量修改提报信息 /ttVsDemandPlan1/edit
// export const editSave = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1/edit`, params)
//
// // 导出 /ttVsDemandPlan1/excel
export const exportExcel = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/excel/d`, params, {
  responseType: 'blob'
});
// // 导出 /ttVsDemandPlan1/excel
export const exportExcelOem = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/excel/oem`, params, {
  responseType: 'blob'
});
// 本月截止提报时间 /tmBusinessPara/getDeadlineTime
export const getDeadlineTime = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/getDeadlineTime`,params )

// 提报状态查询 /ttVsDemandPlan1/checkDoneStatus
export const getStatus = (params) => axios.get(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/checkDoneStatus`, {
  params
})
// // 车辆分页查询 /ttVsPlanTemplate/page
// export const queryCarList = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsPlanTemplate/page`, params)
//
// // / 导出
// export const exporturl = params => axios.post(`/api/cmscloud.excel/downloadExcel/exportExcel/${params.CODE}`, params);


// export const queryCarListSideC = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/queryCarListSideC`, params)
export const queryCarListSideC = (params) => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/vsProduct/queryCarListSideC`, params)


export const getProductBrandTree = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/brand/getProductBrandTree`, { params });
//内饰外饰
export const listColor = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/color/listColor`, { params });
//配置
export const queryAllOption= params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/option/vsOption/queryAllOption`, { params });
//选配
export const queryAllPackage= params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/option/vsOption/queryAllPackage`, { params });
export const queryDealerAddress = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/queryDealerAddress`, params);

export const getCreatePlanInfo= params => axios.get(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/getCreatePlanInfo`, { params });
// 车辆配置五级选择
export const vehicleConfiguration = (id, params) => axios.get(`${SERVER.BASEDATA}/vehicleProduct/productInfo/productTreeNew`, {
  params: {
    type: id,
    level: 6,
    ...params
  }
});
export const queryAllPlanDetail= params => axios.get(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/queryAllPlanDetail`, { params });
export const exportExcelDetail = (params) => axios.post(`${SERVER.WHOLESALES}/ttVsDemandPlan1SideC/excel/detail`, params, {
  responseType: 'blob'
});